package com.dhl.mediator.smarthouse;

import com.dhl.mediator.Mediator;

/**
 * @title: TV
 * @Author danghailiang
 * @Date: 2022/8/22 10:45
 * @Version 1.0
 */
public class TV extends Colleague {


    public TV(String name, Mediator mediator) {
        super(name, mediator);
        // 自我注册
        mediator.register(super.name,this);
    }

    @Override
    protected void sendMessage(int stateChange) {
        this.getMediator().getMessage(stateChange, this.name);
    }

    public void openTV() {
        System.out.println("打开电视");
    }

    public void stopTV() {
        System.out.println("关闭电视");
    }
}
